import request from '@/utils/request'

// 查询商品分类列表
export function listClassify(query) {
  return request({
    url: '/classify/classify/list',
    method: 'get',
    params: query
  })
}
// 查询商品分类列表
export function getNextList(classifyId) {
  return request({
    url: '/classify/classify/getNextList/' + classifyId,
    method: 'get',
  })
}


 // 查询商品分类树列表
export function getCnameList(query) {
  return request({
    url: '/classify/classify/treeselect',
    method: 'get',
    params: query
  })
}

// 查询商品分类详细
export function getClassify(classifyId) {
  return request({
    url: '/classify/classify/' + classifyId,
    method: 'get'
  })
}

// 新增商品分类
export function addClassify(data) {
  return request({
    url: '/classify/classify/add',
    method: 'put',
    data: data
  })
}

// 修改商品分类
export function updateClassify(data) {
  return request({
    url: '/classify/classify',
    method: 'put',
    data: data
  })
}

// 删除商品分类
export function delClassify(classifyId) {
  return request({
    url: '/classify/classify/' + classifyId,
    method: 'delete'
  })
}

// 查询子类
export function Childrenlist() {
  return request({
    url: '/classify/attributes/list',
    method: 'get',
  })
}
// 修改是否启用
export function updateisInNavbar(classifyId,isInNavbar) {
  const data = {
    classifyId,
    isInNavbar
  }
  return request({
    url: '/classify/classify/updateClassifyisInNavbarData',
    method: 'put',
    data: data
  })
}

// 修改是否显示
export function updateisDisplayed(classifyId,isDisplayed) {
  const data = {
    classifyId,
    isDisplayed
  }
  return request({
    url: '/classify/classify/updateClassifyisDisplayedData',
    method: 'put',
    data: data
  })
}
